package typedef

import (
	"github.com/nsqio/go-nsq"
	"sync"
)

type NsqPub struct {
	Topic       string
	NsqProducer *nsq.Producer
}

type NsqSub struct {
	Topic       string
	Addr        string
	NsqConsumer sync.Map
}

type NsqConfig struct {
	HostName string
	Tcp      int
	Http     int
}

type NsqStats struct {
	Health    string           `json:"health"`
	Memory    map[string]int64 `json:"memory"`
	StartTime int64            `json:"start_time"`
	Topics    []NsqTopic       `json:"topics"`
	Version   string           `json:"version"`
}

type NsqTopic struct {
	BackendDepth int          `json:"backend_depth"`
	Channels     []NsqChannel `json:"channels"`
	Depth        int          `json:"depth"`
	MessageCount int          `json:"message_count"`
	Paused       bool         `json:"paused"`
	TopicName    string       `json:"topic_name"`
}

type NsqChannel struct {
	BackendDepth  int           `json:"backend_depth"`
	ChannelName   string        `json:"channel_name"`
	Clients       []interface{} `json:"clients"`
	DeferredCount int           `json:"deferred_count"`
	Depth         int           `json:"depth"`
	InFlightCount int           `json:"in_flight_count"`
	MessageCount  int           `json:"message_count"`
	Paused        bool          `json:"paused"`
	RequeueCount  int           `json:"requeue_count"`
	TimeoutCount  int           `json:"timeout_count"`
}
